package com.shwread.android.ui.dialog;

import android.app.Dialog;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup.LayoutParams;
import android.widget.TextView;
import android.widget.Toast;

import com.shwread.android.qysw.activity.BaseBusinessActivity;
import com.shwread.android.qysw10000182.R;


public class DeleteNotesDialog
        extends
        Dialog
{
	private TextView     vOK;
	private TextView     vCancel;
	
	private BaseBusinessActivity activity;
	
	public DeleteNotesDialog(BaseBusinessActivity activity) {
		super(activity, R.style.common_dialog);
		this.activity = activity;
		findViews();
		setListeners();
		
		getWindow().setLayout(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);
		getWindow().setGravity(Gravity.CENTER);
	}
	
	private void setListeners() {
		ClickListener l = new ClickListener();
		
		vOK.setOnClickListener(l);
		vCancel.setOnClickListener(l);
		
	}
	
	private void findViews() {
		View view = LayoutInflater.from(activity).inflate(R.layout.book_notes_delete_dialog, null);
		vCancel = (TextView) view.findViewById(R.id.book_notes_delete_cancel_tv);
		vOK = (TextView) view.findViewById(R.id.book_notes_delete_ok_tv);
		setContentView(view);
	}
	
	private class ClickListener
	        implements
	        View.OnClickListener
	{
		
		@Override
		public void onClick(View v) {
			
			switch (v.getId()) {
				case R.id.book_notes_delete_ok_tv:
					clickOk();
					break;
				case R.id.book_notes_delete_cancel_tv:
					clickCancel();
					break;
			}
		}

		private void clickCancel() {
			dismiss();	        
        }

		private void clickOk() {
			dismiss();
	        Toast.makeText(activity, "您已成功删除笔记", 2000).show();
	        
        }
		
	}
}
